package cn.com.fuhuitong.custom

import android.content.Context
import android.util.AttributeSet
import androidx.core.widget.NestedScrollView
import androidx.recyclerview.widget.RecyclerView

class AnimationRecyclerView : RecyclerView {
    private var listener: OnAnimationScrollListener? = null

    constructor(context: Context) : super(context) {}

    constructor(
        context: Context,
        attrs: AttributeSet?
    ) : super(context, attrs)

    constructor(
        context: Context,
        attrs: AttributeSet?,
        defStyleAttr: Int
    ) : super(context, attrs, defStyleAttr)

    fun setOnAnimationScrollListener(listener: OnAnimationScrollListener?) {
        this.listener = listener
    }

    interface OnAnimationScrollListener {
        fun onScrolled(dy: Float)
    }

    private var scrollY1: Int = 0
    override fun onScrolled(dx: Int, dy: Int) {
        super.onScrolled(dx, dy)
        scrollY += dy
        listener?.onScrolled(scrollY1 * 0.65f)
    }

}